<?php
namespace app\admin\controller;

use app\common\controller\AdminController;
use app\admin\validate\Admin;
use app\admin\model\Admin as adminModel;
use think\facade\View;
use think\facade\Request;
use think\facade\Db;
use think\facade\Session;
use think\exception\ValidateException;
use app\common\model\User as UserModel;

class Authgroup extends AdminController
{
	/**
	protected function initialize()
    {
        parent::initialize();
       
    }
	*/
	//用户表
	public function list()
	{
		if(Request::isAjax()){
			$user = Db::name('user')->select();
			$count = $user->count();
			$res = [];
			if($user){
				$res = ['code'=>0,'msg'=>'','count'=>$count];
				
				foreach($user as $k => $v){
				$data = ['id'=>$v['id'],'username'=>$v['name'],'avatar'=>$v['user_img'],'phone'=>$v['phone'],'email'=>$v['email'],'sex'=>$v['sex'],'ip'=>'','jointime'=>date("Y-m-d",$v['create_time'])];
				$res['data'][] = $data; 
				}
			}
			return json($res);
		}
		return View::fetch('role');
	}
	
	

	
	//角色管理
	public function role()
	{
		//
		return View::fetch('role');
	}
	
	//角色添加
	public function roleAdd()
	{
		//
		return View::fetch('roleform');
	}
	
	//角色编辑
	public function roleForm()
	{
		//
		return View::fetch('roleform');
	}


	
}
